<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@ taglib uri="/mytag" prefix="yjd"%>
<body>
<div class="wrap">
    <div class="nav">
        <div class="return">
            <a href="${requestScope.FPWEB.rootPath }/order/list${requestScope.FPWEB.urlStuff}">返回上一级</a>
        </div>
    </div>
    <div class="h_a">订单详情</div>
    <div class="table_full">
        <table width="100%">
            <tbody>
            <tr>
                <th width="100">订单id</th>
                <td>${orderModel.order_id}</td>
            </tr>
            <tr>
                <th width="100">订单号</th>
                <td>${orderModel.order_no}</td>
            </tr>
            <tr>
                <th width="100">商户确认时间</th>
                <td>${orderModel.strMap.confirm_time}</td>
            </tr>
            <tr>
                <th width="100">结算日期</th>
                <td>${orderModel.strMap.clear_date}</td>
            </tr>
            <tr>
                <th width="100">用户姓名</th>
                <td>${user.idname}</td>
            </tr>
            <tr>
                <th width="100">手机号</th>
                <td>${user.mobile_number}</td>
            </tr>
            <tr>
                <th width="100">订单总额</th>
                <td><f:formatNumber value="${orderModel.order_amount}" pattern=",##0.00"/></td>
            </tr>
            <tr>
                <th width="100">借款金额</th>
                <td><f:formatNumber value="${orderModel.loan_amount}" pattern=",##0.00"/></td>
            </tr>
            <tr>
                <th width="100">已还金额</th>
                <td><f:formatNumber value="${orderModel.interest_pay}" pattern=",##0.00"/></td>
            </tr>
            <tr>
                <th width="100">分期期数</th>
                <td>${orderModel.period}</td>
            </tr>
            <tr>
                <th width="100">借款时间</th>
                <td><yjd:jstl_date value="${orderModel.create_time }" parttern="yyyy-MM-dd HH:mm:ss"/></td>
            </tr>
            </tbody>
        </table>
    </div>

    <div class="h_a"> 借款项目</div>
    <div class="table_list">
        <table width="100%">
            <thead>
            <tr>
                <td>项目编号</td>
                <td>项目名称</td>
                <td>项目金额</td>
                <td>首付金额</td>
                <td>借款金额</td>
                <td>所属机构</td>
                <td>所属医生</td>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${orderProjectModelList }" var="item" >
                <tr>
                    <td>${item.project_id}</td>
                    <td>${item.strMap.prj_name}</td>
                    <td>${item.strMap.price}</td>
                    <td>${item.strMap.payment}</td>
                    <td>${item.strMap.loan_price}</td>
                    <td>${item.strMap.org_name}</td>
                    <td>${item.strMap.dc_name}</td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>

    <div class="h_a">还款报表</div>
    <div class="table_list">
        <table width="100%">
            <thead>
            <tr>
                <td>还款日</td>
                <td>期数</td>
                <td>还款金额</td>
                <td>罚息金额</td>
                <td>逾期天数</td>
                <td>减免金额</td>
                <td>还款时间</td>
                <td>还款状态</td>
                <td>操作</td>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${repaymentDataModelList }" var="item" >
                <tr>
                    <td><yjd:jstl_date value="${item.estimation_repayment_time }" parttern="yyyy-MM-dd"/></td>
                    <td>${item.period}</td>
                    <td><f:formatNumber value="${item.repayment_amount}" pattern=",##0.00"/></td>
                    <td><f:formatNumber value="${item.strMap.overduePrice}" pattern=",##0.00"/></td>
                    <td>${item.strMap.overdueDay}</td>
                    <td><f:formatNumber value="${item.discount_amount}" pattern=",##0.00"/></td>
                    <td>
                        <c:if test="${item.repayment_status==1}"><yjd:jstl_date value="${item.create_time }" parttern="yyyy-MM-dd HH:mm:ss"/></c:if>
                    </td>
                    <td>
                        <c:if test="${item.repayment_status==0}">未还</c:if>
                        <c:if test="${item.repayment_status==1}">已还清</c:if>
                        <c:if test="${item.repayment_status==2}">已取消</c:if>
                    </td>
                    <td>
                        <c:if test="${item.repayment_status==0}">
                            <a class="btn btn_orange " href="javascript:discount_price('<yjd:url url='/order/discount'/>','${item.id}');" >设置减免费用</a>
                            &nbsp;&nbsp;&nbsp;
                            <a class="btn btn_submit J_ajax_del" href="${requestScope.FPWEB.rootPath }/order/repayment/${item.id}${requestScope.FPWEB.urlStuff}?" data-msg="确定当期还款？">还款</a>
                        </c:if>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>

    <div class="h_a"> 芝麻信用信息</div>
    <div class="table_list">
        <table width="100%">
            <thead>
            <tr>
                <td>芝麻信用分数</td>
                <td>行业风险评级</td>
                <td>防欺诈判断</td>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td><c:if test="${zhimaInfo.credit_score == 0}">无</c:if><c:if test="${zhimaInfo.credit_score > 0}">${zhimaInfo.credit_score}</c:if></td>
                <td>${zhimaInfo.strMap.creditLabel}</td>
                <td><c:if test="${zhimaInfo.fraud_flag == 0}">否</c:if><c:if test="${zhimaInfo.fraud_flag == 1}">是</c:if></td>
            </tr>
            </tbody>
        </table>
    </div>


</div>
<script>
    YJD.use('AppAdminCommon');

    function discount_price(_url, _aid) {
        var dialog_content = "<strong>减免金额:</strong><input name='price' id='price' style='width:300px;height:30px;'/>";
        art.dialog({
            title : "减免金额",
            content : dialog_content,
            ok : function() {
                var discount_price = $("#price").val();
                if(discount_price==''){
                    alert("必须填写减免金额");
                    return false;
                }

                $.ajax({
                    type : "post",
                    url : _url,
                    data : {
                        repayment_id : _aid,
                        price:discount_price
                    },
                    dataType : "json",
                    timeout : 3000,
                    cache : false,
                    async : true,
                    beforeSend : function() {
                    },
                    success : function(data) {
                        alert(data.message);
                        $("#search_form").submit();
                    },
                    error : function(msg) {

                    }
                });
                return true;
            },
            cancel : function() {

            }
        });
    }
</script>
</body>